package com.xian.im.message.queue;

import com.xian.im.common.enums.ConsumerQueueEnum;
import com.xian.im.message.model.QueueMsg;

import java.util.concurrent.LinkedBlockingQueue;

/**
 * @program: xian-im-server
 * @description:
 * @author: liru.xian
 * @create: 2021-02-01 17:29
 **/
public class MessageHeartbeatQueue {

    private static LinkedBlockingQueue<QueueMsg> HEARTBEAT_QUEUE = new LinkedBlockingQueue();

    public static QueueMsg take(){
        try {
            return  HEARTBEAT_QUEUE.take();
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static void  put(QueueMsg obj){
        try {
            HEARTBEAT_QUEUE.put(obj);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }

    /**
     * @return
     */
    public static ConsumerQueueEnum getType() {
        return ConsumerQueueEnum.CONSUMER_HEARTBEAT;
    }
}
